﻿//using System;
//using System.Drawing;
//using YCG.FCL.Common.Win32;

//namespace SharpCommon.Utility
//{
//    public class ScreenHelper
//    {
//        public static void ScreenShot(IntPtr windowHandle, string savePath)
//        {
//            Image image = ScreenShot(windowHandle);
//            image.Save(savePath);
//        }

//        public static void FullScreenShot(string savePath)
//        {
//            ScreenShot(GDIAPI.GetDesktopWindow(), savePath);
//        }

//        public static Image ScreenShot(IntPtr windowHandle)
//        {
//            IntPtr hdcSrc = GDIAPI.GetWindowDC(windowHandle);
//            Common.Win32.Rectangle windowRect = new Win32.Rectangle();
//            WindowsAPI.GetWindowRect(windowHandle, out windowRect);
//            int width = windowRect.Right - windowRect.Left;
//            int height = windowRect.Bottom - windowRect.Top;
//            IntPtr hdcDest = GDIAPI.CreateCompatibleDC(hdcSrc);
//            IntPtr hBitmap = GDIAPI.CreateCompatibleBitmap(hdcSrc, width, height);
//            IntPtr hOld = GDIAPI.SelectObject(hdcDest, hBitmap);
//            GDIAPI.BitBlt(hdcDest, 0, 0, width, height, hdcSrc, 0, 0, 0x00CC0020);
//            GDIAPI.SelectObject(hdcDest, hOld);
//            GDIAPI.DeleteDC(hdcDest);
//            GDIAPI.ReleaseDC(windowHandle, hdcSrc);
//            Image img = Image.FromHbitmap(hBitmap);
//            GDIAPI.DeleteObject(hBitmap);
//            return img;
//        }
//    }
//}
